<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/jquery-1.8.3.min.js"></script>
    <script>
    function zan(id){
        $.ajax({
            url:"/addZan",
            type:"get",
            data:"id="+id,
            success:function (data){
                console.log(data)
                $('#countZan').text(data);
            }
        })
    }
</script>
</head>
<body>
    <h1 style="text-align: center">新闻1</h1>
    阅读数 <span th:text="${read}"></span>
    点赞数 <font id="countZan" color="red" th:text="${zan==null?0:zan}"></font>&nbsp;&nbsp;
    <input type="button" onclick="zan(1)" value="点赞"/>
</body>
</html>